<template>
  <div class="radio" :class="isChecked?'radio-active':''" @click="handleClick">
    {{label}}
  </div>
</template>
<script>
export default {
  name: 'JRadio',
  data () {
    return {
      isChecked: false
    };
  },
  props: {
    value: {
      type: Object
    },
    label: {
      type: String
    }
  },
  methods: {
    handleClick () {
      this.$parent.$emit('change', this.value);
    },
    checkIsActive (value, isChange) {
      this.isChecked = this.label === value;
      if (this.label === value && isChange) {
        this.$parent.$emit('change', this.value);
      }
    }
  }
};
</script>
<style lang="less" scoped>
.radio {
  border: 1px solid #bbb; /*no*/
  padding: 10px 28px;
  color: #353535;
  display: inline-block;
  margin-right: 20px;
  font-size: 28px;
  margin-bottom: 20px;
  border-radius: 40px;
}
.radio.radio-active {
  border: 1px solid #007aff;
  background-color: #007aff;
  color: #fff;
}
</style>
